import App from './App'
import Vue from 'vue'
// 功能js
import util from '@/common/util'
// 混入js
import mix from '@/common/mixin/index.js'
// 请求js
import api from '@/api/ajax.js'
import uView from "uview-ui";
// 数据状态管理
import store from './store'
// 即时通讯
import './im'
Vue.use(uView);

import $upload from './common/ossutil/uploadFile';
Vue.prototype.$upload = $upload;
Vue.prototype.$ossPath = 'https://golfdate.oss-cn-shenzhen.aliyuncs.com';

Vue.config.productionTip = false
App.mpType = 'app'
const app = new Vue({
	...App
})
app.$mount()
// 添加全局方法
Vue.prototype.$util = util;
Vue.prototype.$api = api;
Vue.prototype.$store = store;


// 混入js加到vue全局混入
Vue.mixin(mix)


// 错误提示
const msg = (title, duration = 1500, mask = false, icon = 'none') => {
	//统一提示方便全局修改
	if (Boolean(title) === false) {
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}
// 成功提示
const success = (title, duration = 1500, mask = false, icon = 'success') => {
	//统一提示方便全局修改
	if (Boolean(title) === false) {
		return;
	}
	uni.showToast({
		title,
		duration,
		mask,
		icon
	});
}
//加载中提醒
const load = (title = '正在处理') => {
	uni.showLoading({
		title: title
	});
	setTimeout(() => {
		uni.hideLoading();
	}, 3000)
}
// 清除加载提醒
const closeLoad = () => {
	uni.hideLoading();
}

// 添加全局方法
Vue.prototype.$pv = {
	msg,
	closeLoad,
	load,
	success
}